package com.gnerv.battle.boot.project.guard.business.impl;

import com.gnerv.battle.boot.common.spring.tool.IpTools;
import com.gnerv.battle.boot.project.guard.business.MonitorNodeConfigBusiness;
import com.gnerv.battle.boot.project.guard.service.MonitorProjectNodeService;
import jakarta.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @author Gnerv LiGen
 */
@Slf4j
@Service
@AllArgsConstructor
public class MonitorNodeConfigBusinessImpl implements MonitorNodeConfigBusiness {

    private final MonitorProjectNodeService monitorProjectNodeService;

    @Override
    public String selectConfigFileByUkId(String ukId, HttpServletRequest request) {
        String ipAddress = IpTools.getIpAddress(request);
        String host = monitorProjectNodeService.selectHostByUkId(ukId);
        // 比较ip
        return monitorProjectNodeService.selectConfigFileByUkId(ukId);
    }
}
